MPT.addTmpl('message_friend', function(_data){
	
	var html = [];
		html.push('<div class="contenter message" id="contenter">');
		html.push('<div class="mpt a_message_friend">');
		html.push('    <div class="title"><em class="clear e_clear" title="清空请求消息">清空请求消息</em></div>');
		html.push('    <div class="subnav">');
		html.push('        <a target="hashtarget" href="#!/message/friend" class="active" title="好友请求">好友请求<em class="nub e_friend_count">0</em></a>');
		html.push('        <a target="hashtarget" href="#!/message/notice" title="系统通知">系统通知<em class="nub e_notice_count">0</em></a>');
		html.push('    </div>');
		html.push('    <div class="message_content e_msg_list">');
		html.push('    </div>');
		html.push('    <div class="paging e_page"></div>');
		html.push('</div>');
		html.push('</div>');
	return html.join('');

});


MPT.addTmpl('one_message', function(_data) {
    var html = [];

    //接收方
    var targetnickname = _data.targetnickname;
    var targetid = _data.targetid;

    //发送方
    var uid = _data.uid;
    var nickname = _data.nickname;

    var send_time = Util.getFormatDateByLong(_data.ts, 'yyyy-MM-dd hh:mm');
    var message = _data.message;
    var group_id = _data.groupId;

    var apply = _data.apply;
    var status = parseInt(_data.status);

    var avatarPath = Util.avatarPath(uid, 33);
    var spacePath = Util.spacePath(uid);

    var hint = '';
    switch (status) {
        case 0: hint = "该用户请求添加您为好友"; break;
        case 1: hint = "您已接受该用户的好友请求"; break;
        case 2: hint = "您已忽略了该用户的好友请求"; break;
        case 3: hint = "该用户已通过了您的好友请求"; break;
        case 4: hint = "该用户拒绝了你的好友请求"; break;
    }

    html.push('        <dl class="message_box e_one_msg">');
    html.push('            <dt class="head">');
    html.push('                <h2 class="req request">好友请求：</h2>');
    html.push('                <a class="head_pic" href="' + spacePath + '"><img src="' + avatarPath + '" alt=""></a>');
    html.push('            </dt>');
    html.push('            <dd class="content">');
    html.push('                <a class="close e_close" href="javascript:;" title="关闭"></a>');
    html.push('                <ul class="rightside">');
    html.push('                    <li class="inp_box">');

    //对方请求消息，才显示消息框
    if (status == 0 || status == 1 || status == 2) {
        html.push('                        <div class="sanjiao block1">◆</div>');
        html.push('                        <div class="sanjiao block2">◆</div>');
        html.push('                        <div class="txtarea">' + message + '</div>');
    }

    html.push('                    &nbsp;</li>');
    html.push('                    <li class="btn_box">');
    html.push('                        <p class="date">' + send_time + '</p>');

    //未处理的消息，添加接受和忽略
    if (status == 0) {
        html.push('                        <div class="btn e_operate">');
        html.push('                            <div class="btn1_24 accept"><strong class="btn2_24 e_agree" title="接受">接受</strong></div>');
        html.push('                            <div class="btn1_24 lgnone"><strong class="btn2_24 e_ignore" title="忽略">忽略</strong></div>');
        html.push('                        </div>');
    }

    //添加分组功能
    if (status == 0 || status == 1 || status == 3) {
        html.push('<div class="list e_group_manage">');
        html.push('</div>');
    }

    html.push('                    </li>');
    html.push('                </ul>');
    html.push('                <h2 class="name"><a href="' + spacePath + '" title="' + nickname + '">' + nickname + '</a></h2>');
    html.push('                <p class="e_hint ' + (status == 0 ? "" : "block") + '">' + hint + '</p>');
    html.push('            </dd>');
    html.push('        </dl>');
    return html.join('');
});